function getStyle(obj, name) {
  if (obj.currentStyle) {
    return obj.currentStyle
  } else {
    return getComputedStyle(obj, false)[name]
  }
}

function startmove(obj, attr, itarget,fnEnd) {
  clearInterval(obj.timer)
  obj.timer = setInterval(() => {
    var cur = 0;
    if (attr == 'opacity') {
      cur = Math.round(parseFloat(getStyle(obj, attr)) * 100)
    } else {
      cur = parseInt(getStyle(obj, attr))
    }
    var speed = (itarget - cur) / 6
    speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed)
    if (cur == itarget) {
      clearInterval(obj.timer)
      if (fnEnd)fnEnd();
    } else {
      if (attr == 'opacity') {
        obj.style.opacity = (cur + speed) / 100;
      } else {
        obj.style[attr] = cur + speed + 'px'
      }
    }
  }, 30)
}
